package com.avetti.commerce.webservices;

import java.util.List;

import org.codehaus.xfire.MessageContext;
import org.codehaus.xfire.fault.XFireFault;

import com.avetti.commerce.domainmodel.Attributes;
import com.avetti.commerce.domainmodel.Options;

/**
 * A web service of attributes. Required to authenticate a user and set
 * vendor id to work with, before launch any service method
 * @author D.Minenko
 *
 * @see WebServiceAuthHandler
 * @see WebServiceVendorIdHandler
 */
public interface AttributeService_Orig {
    /**
     * Find a attributes by vendor identifier
     * @param vendorId vendor identifier
     * @param context SOAP message context
     * @return list of attributes domain models of specified attributes 
     * identifiers. If no attributes has been found, list will be an empty
     */
    public List<Attributes> find();
    /**
     * Find a attributes by list of identifiers and vendor identifier
     * @param vendorId vendor identifier
     * @param attributesId list of attributes identifiers, which will find
     * @param context SOAP message context
     * @return list of attributes domain models of specified attributes 
     * identifiers. If no attributes has been found, list will be an empty
     */
    public List<Attributes> find(List<Long> attributesId);
    /**
     * Find a attribute by identifier
     * @param attributeId attribute identifier
     * @return attribute or null if attribute note found
     */
    public Attributes find(Long attributeId);
    /**
     * Find a attributes for item
     * @param item item instance
     * @return list of attributes domain models of specified attributes 
     * identifiers. If no attributes has been found, list will be an empty
     */
    public List<Attributes> find(Items item);
    /**
     * Find attributes that not belonged to item
     * @param item item instance
     * @return attributes list
     */    
    public List<Attributes> findExcludeItemAttrib(Items item);    
    /**
     * Remove attributes. 
     * @param attributesId list of attributes identifiers, which will find
     * @param context SOAP message context
     */
    public void delete(List<Long> attributesId);
    /**
     * Copy attribute. 
     * @param attribute attribute for copy
     * @param context SOAP message context
     */
    public void copy(Attributes attribute)throws XFireFault;
    /**
     * Create attribute. 
     * @param attribute attribute for create
     * @param context SOAP message context
     */
    public Attributes create(Attributes attribute)  throws XFireFault;
    
    /**
     * Create a list of attributes.
     * atttype and dataname of each attribute shouldn't empty.
     * only if all attributes from the list doesn't exit creates all attributes from the list
     * @param attributesToAdd
     * @param context
     * @throws XFireFault
     */
    public List<Attributes> createAttributes(List<Attributes> attributesToAdd) throws XFireFault;
    
    /**
     * Update attribute. 
     * @param attribute attribute for update
     * @param context SOAP message context
     */
    public void update(Attributes attribute) throws XFireFault;   
    /**
     * Delete attribute option by code. 
     * @param attribute attribute for update
     * @param optionCode attribute option code for delete
     * @param context SOAP message context
     */
    public void removeOption(Attributes attribute,String optionCode)  
    throws XFireFault;
    
    /**
     * Add attribute option to attribute by id 
     * @param attributeId attribute identifier
     * @param options option for add
     * @param context SOAP message context
     */
    public Options addOption(long attributeId, Options options)  
    throws XFireFault;
    
    /**
     * Find Attributes by its code, which is unique per store. 
     * @param attributeCode
     * @param context
     * @return
     */
    public Attributes findByCode(String attributeCode);
}
